package castle.defense.project;

import android.graphics.Canvas;
/**
 * Abstract renderable class.
 * ANY OBJECT THAT WISHES TO BE PAINTED ON THE SCREEN MUST EXTEND THIS CLASS.
 * 
 * @author Daniel Wasserman
 *
 */
//interface contract for the set of Drawable Objects
public abstract class Renderable implements Comparable<Renderable> {
	
	//paint the object on the canvas
	public abstract void draw(Canvas c);
	
	//update function, can be blank
	public abstract void update(long milli);
	
	//returns the height of the object, z coord if you will (constants)
	public abstract int height();
	
	//asks if this object should be destroyed at the next safe time
	public abstract boolean destroy();
	
	//low priority = paint first (example background image)
	public int compareTo(Renderable o) {
		//the other one should be painted AFTER
		if(o.height() > this.height())
			return -1;
		return 1;
	}
}
